/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.cloudfarming.client.geoviewer.jxmap.layerlist;

import java.awt.Color;
import java.awt.Dimension;
import javax.swing.ListSelectionModel;
import javax.swing.border.BevelBorder;
import net.miginfocom.swing.MigLayout;
import org.jdesktop.swingx.JXPanel;
import org.jdesktop.swingx.painter.CompoundPainter;
import org.jdesktop.swingx.painter.MattePainter;
import org.jdesktop.swingx.painter.PinstripePainter;
import org.openide.explorer.view.ListView;

/**
 *
 * @author Timon Veenstra
 */
public class LayerListPanel extends JXPanel {

    //TODO retrieve colors from a branded color scheme
    //private static final Color COLOR_1 = new Color(191, 148, 6);
    private static final Color COLOR_BASE = new Color(142, 190, 6);
    private static final Color COLOR_SHADOW = new Color(49, 141, 6);
    private static final Color COLOR_HIGH = new Color(49, 255, 6);
    private final ListView listView = new ListView();

    public LayerListPanel() {
        listView.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listView.setPreferredSize(new Dimension(200, 200));
        setPreferredSize(new Dimension(200, 600));
        setLayout(new MigLayout("wrap 1"));
        setupPainters();
        setBorder(new BevelBorder(BevelBorder.RAISED, COLOR_HIGH, COLOR_SHADOW));
        setDoubleBuffered(true);
        add(listView, "dock north");
        setAlpha(.8f);
    }

    private void setupPainters() {
        //Tom doesnt like the gloss :)
//        GlossPainter gloss = new GlossPainter(new Color(1.0f, 1.0f, 1.0f, 0.2f),
//                GlossPainter.GlossPosition.TOP);
        PinstripePainter stripes = new PinstripePainter();
        stripes.setPaint(new Color(1.0f, 1.0f, 1.0f, 0.17f));
        stripes.setSpacing(5.0);

        MattePainter matte = new MattePainter(COLOR_BASE);

        setBackgroundPainter(new CompoundPainter(matte, stripes));
    }


}
